<!-- 可换签 服务和辅材 换签页 -->
<template>
	<view class="">
		<!-- 头部 -->
		<!-- <view class="">
			<view class="uni-page-head" v-if="titleFlag">
				<image class="common-title-img" style="left: 20rpx;"
					:src="require('../../static/imges/fanhui.png')" @click="back()"></image>
					 <view class="common-title-img">
						<u-icon name="arrow-right" color="#FFFFFF" width="20rpx" height="20rpx" size="48" @click="back()"></u-icon>
					</view> 
				<view class="uni-page-head-title">
					换签页
				</view>
			</view>
			<view v-if="titleFlag" style="margin-top: 98rpx;">
				这个盒子是用来撑空间，又不想改变下边的body盒子 所以在这加了一个空盒子，可以根据新老MOA判断
			</view>
		</view> -->
		<!-- 扫码详情页面 -->
		<!-- <uni-collapse style="padding: 10rpx;">
			<uni-collapse-item class="collapseItem" :open="true">
				<template v-slot:title>
					<image style="width: 45rpx;height: 40rpx;margin-bottom: -5px;" src="../../static/imges/wendang3.png" mode=""></image>
					<uni-icons type="image" color="#EB4B4B" size="20"></uni-icons>
					<text>物资信息</text>
				</template>
				<view class="content">
				
					
					<view class="contentItem">
						<text class="text">原标签ID</text>
						<text :selectable="true" style="color: #007AFF;" @click="schemeert(data.resourceAssetCode,data.labelId)">{{(data.labelId!=null&&data.resourceAssetCode!=null)?data.labelId:""}}</text>
			            <text :selectable="true" style="color: black;">{{(data.labelId==null||data.resourceAssetCode==null)?data.labelId||"无":""}}</text>
					</view>
					<view class="contentItem">
						<text class="text">新标签ID</text>
						
							<text :selectable="true" v-if="newId" style="color: #D9001B;">请点击扫描按键获取新签</text>
						    <text :selectable="true" v-if="!newId" style="color: #007AFF;"  @click="schemeert(data.resourceAssetCode,newIdCode)">{{(newIdCode!=null&&data.resourceAssetCode!=null)?newIdCode:""}}</text>
			                <text :selectable="true" v-if="!newId" style="color: black;">{{(newIdCode==null||data.resourceAssetCode==null)?newIdCode:""}}</text>
						
						    <image @click="scanCode()" style="width: 38rpx;height: 38rpx;position: absolute;right: 22rpx;top: 120rpx;"
						    	src="../../static/imges/扫描saomiaored.png" mode=""></image>
							<uni-icons @click="scanCode()" style="position: absolute; right: 20rpx;top: 100rpx;" type="scan" color="#EB4B4B" size="20"></uni-icons>
					
						
					</view>
					<view class="contentItem">
						<text class="text">物料名称</text>
						<text :selectable="true">{{data.categoryName}}</text>
					</view>
					<view class="contentItem">
						<text class="text">物料编码</text>
						<text :selectable="true">{{data.categoryCode}}</text>
					</view>
				</view>
			</uni-collapse-item>
			
		</uni-collapse> -->
		<view style="width: 98%;margin: 14rpx auto;">
			<view style="width: 100%;background-color: white;padding: 6rpx 14rpx;margin-bottom: 10rpx;">
				<view style="display: flex;font-size: 30rpx;font-weight:bold;margin-bottom: 10rpx;">
					<view style="width: 24rpx;">
						<view style="width: 14rpx; height: 36rpx;background-color: #EB4B4B;margin-top: 10rpx;">
						</view>
					</view>
					物料信息
				</view>
				<view style="width: 100%;">
					<view class="common-list-a">
								
						<label class="common-list-b" style="">物料名称 :</label>
						
						<text class="common-list-c" style="height: auto;" type="text" :selectable="true">{{data.categoryName}}</text>
								
					</view>
					<view class="common-list-a">
								
						<label class="common-list-b" style=";">物料编码 :</label>
						
						<text class="common-list-c" style="height: auto;" type="text" :selectable="true">{{data.categoryCode}}</text>
								
					</view>
				</view>
			</view>
			<view style="width: 100%;background-color: white;padding: 6rpx 14rpx;margin-bottom: 10rpx;">
				<view style="display: flex;font-size: 30rpx;font-weight:bold;margin-bottom: 10rpx;">
					<view style="width: 24rpx;">
						<view style="width: 14rpx; height: 36rpx;background-color: #EB4B4B;margin-top: 10rpx;">
						</view>
					</view>
					标签信息
				</view>
				<view style="width: 100%;">
					<view class="common-list-a">
						<label class="common-list-b" style="width: 28%;">资源资产编码 :</label>
						<text class="common-list-c" style="height: auto;width: 72%;" type="text" :selectable="true">{{data.resourceAssetCode || '无'}}</text>	
					</view>
					<view class="common-list-a">	
						<label class="common-list-b" style=""> 原标签ID :</label>
						<view class="common-list-c" style="height: auto;">
							<text :selectable="true" style="color: #007AFF;"  @click="schemeert(data.resourceAssetCode,data.labelId)">{{(data.labelId!=null&&data.resourceAssetCode!=null)?data.labelId:""}}</text>
							<text :selectable="true" style="color: black;">{{(data.labelId==null||data.resourceAssetCode==null)?data.labelId||"无":""}}</text>
						</view>
						
					</view>
					<view class="common-list-a" style="position:relative">	
						<label class="common-list-b" style="">新标签ID :</label>
						<view class="common-list-c" style="height: auto;">
							<text v-if="newId"  style="color: #D9001B;" type="text" :selectable="true">请点击扫描按键获取新签</text>
							<text :selectable="true" style="color: #007AFF;"  @click="schemeert(data.resourceAssetCode,newIdCode)">{{(newIdCode!=null&&data.resourceAssetCode!=null)?newIdCode:""}}</text>
							<text :selectable="true"  style="color: black;">{{(newIdCode==null||data.resourceAssetCode==null)?newIdCode:""}}</text>
						</view>					
						<image @click="scanCode()" style="width: 38rpx;height: 38rpx;position: absolute;right: 22rpx;top: 18rpx;"
							src="../../static/imges/扫描saomiaored.png" mode=""></image>
					</view>
					<view class="common-list-a"  v-if="!newId" >
						<label class="common-list-b" style="position:relative;padding-left: 26rpx;width: 20%;"> <span style="color: #D9001B;position: absolute;left: 8rpx;top: 14rpx;">*</span> 换签原因 :</label>
						<view class="common-list-c" style="background-color: #FAFAD2;height: 70rpx;">
							<picker @change="aPickerChange" :value="aIndex" :range="ftypeCode" range-key="name">
								<input class="uni-input" style="height: auto;background-color: #FAFAD2;padding-left: 20rpx;margin-left: -15rpx;" :value="selected1Type" type="text" disabled="disabled" placeholder="请选择换签原因" >
							</picker>
						</view>
					</view>
				</view>
			</view>
            <view v-if="Sinformation" style="width: 100%;background-color: white;padding: 6rpx 14rpx;margin-bottom: 10rpx;">
            	<view style="display: flex;font-size: 30rpx;font-weight:bold;margin-bottom: 10rpx;">
            		<view style="width: 24rpx;">
            			<view style="width: 14rpx; height: 36rpx;background-color: #EB4B4B;margin-top: 10rpx;">
            			</view>
            		</view>
            		贴签信息
            	</view>
            	<view style="width: 100%;" >
            		<view class="common-list-a">
            			<label class="common-list-b" style="display: flex;">
            				<text><span  style="color: red;">*</span>贴签位置 :</text>
            			</label>
            			<text class="common-list-c" style="height: auto;background-color: white;" type="text" :selectable="true"><input type="text" v-model="Sticker"  placeholder="请输入贴签位置" style="font-size: 28rpx;" maxlength="80"/></text>
            		</view>
            		<view class="common-list-a">
            			<label class="common-list-b" style=""><text><span  style="color: red;">*</span>贴签照片 :</text></label>
            		</view>
            		<view class="common-list-a" style="padding: 15rpx;">
            			<scroll-view scroll-x="true" style="white-space: nowrap;width: 100%;" scroll-left="120"
            				show-scrollbar="true">
            				<view class="photo-item"  v-for="(image,index2) in tupianList" :key="index2">
            					<image class="photo-image" :src="fileData(image.fileUrl)" :data-src="image"
            						@tap="previewImage(image,index2)" style="width: 120rpx;height: 120rpx"></image>
            					<image @click="delectImg(index2)" class="photo-delete-btn"
            						src="../../static/imges/shanchu2.png">
            					</image>
            				</view>
            				<view class="photo-item" v-if="showPhotoer">
            						<image class="photo-image"  :src="require('@/static/imges/shangchuanimg.png')"
            						       style="width: 122rpx;height: 122rpx;"
            						@click="showPhoto()"></image>
            				</view>
            			</scroll-view>
            		</view>
            	</view>
            </view>
		</view>
		<view class="buttonBox" v-if="!newId">
			<button v-debounce="() => onOk(1)" type="warn" style="font-size: 28rpx;width: 48%;height: 66rpx;">确认</button>
			<button v-debounce="() => onOk(2)" type="warn" style="font-size: 28rpx;width: 48%;height: 66rpx;">取消</button>
		</view>
		<!-- 换签模式弹框 -->
		<u-modal v-model="isShowModal" title="换签确认" confirm-text="取消" :title-style="{fontWeight:'bold',fontSize:'40rpx'}">
			<view class="" style="color: #3478F7;text-align: center;border: 1px solid #F2F2F2;height: 100rpx;line-height: 100rpx;font-size: 30rpx;">
				<text v-debounce="() => modalClick('01')">换签（原标签保留)</text>
			</view>
			<view class="" style="color: #3478F7;text-align: center;border: 1px solid #F2F2F2;height: 100rpx;line-height: 100rpx;font-size: 30rpx;">
				<text  v-debounce="() => modalClick('02')">换签（原标签遗失或破损）</text>
			</view>
		</u-modal>
		<view class="">
			<u-popup v-model="bottomShow" mode="bottom">
				<view style="height: 300rpx;">
					<view v-debounce="() => getCamera()"
						style="width: 100%;height: 100rpx;border-bottom: 1px solid #D3D3D3;text-align: center;line-height: 100rpx;">
						<text style="font-size: 15px;">拍摄</text>
		
					</view>
					<view v-debounce="() => getSelectImg()"
						style="width: 100%;height: 100rpx;border-bottom: 1px solid #D3D3D3;text-align: center;line-height: 100rpx;">
						<text style="font-size: 15px;">相册选择</text>
		
					</view>
					<view @click="cancel()"
						style="width: 100%;height: 100rpx;border-bottom: 1px solid #D3D3D3;text-align: center;line-height: 100rpx;">
						<text style="font-size: 15px;">取消</text>
		
					</view>
				</view>
			</u-popup>
		</view> 
	</view>
	
	
</template>

<script>
	export default {
		data(){
			return {
				ionerid:"",
				Permissionid:"",
				Sticker:"",
				fileer:"",
				showPhotoer:true,				
				bottomShow:false,
				tupianList:[],
				Sinformation:false,
				
				
				falseer:false,
				titleFlag:true,
				newId:true, // 控制新 ID 显示隐藏
				data:[],
				labelCode: {},
				newIdCode:'',
				flag:'',
				isShowModal:false, // 确认换签模式的弹框显示隐藏
				swapMode:'01', // 换签模式
				aIndex:"",
				selected1Type:"",
				reasoner:"",
				ftypeCode:[
					{
						key:"2",
						name:"标签脱落且丢失"
					},
					{
						key:"3",
						name:"标签质量问题无法扫码识别"
					},
					{
						key:"4",
						name:"标签类型使用有误更换为规范类型"
					},
					{
						key:"5",
						name:"质量问题厂家更换实物"
					},
					
				],
			}
		},
		watch:{
			tupianList(){
				console.log("有无数据000",this.tupianList.length)
				if(this.tupianList.length==0){
					this.showPhotoer=true;
				}else{
					this.showPhotoer=false;
				}
			}
		},
		onLoad(option) {
			// 控制是否显示表头
			if(uni.getStorageSync('moaType')=="0"){
					this.titleFlag=false
			}
			let item = JSON.parse(decodeURIComponent(option.item))
			this.flag = option.index
			this.ionerid=option.prjIder
			
				this.data = item
			 console.log('换签页得到的数据',this.ionerid,this.data);
			this.Permissioner()
			 this.toSignChangeimg()
		},
		methods:{
			toSignChangeimg(item, item1){
					  console.log(item1,item)
					  uni.request({
					  	url:uni.getStorageSync("PMS20url")+"/api/app/mainMaterialLable/queryLabelDetail?osDetailId=&labelId="+this.data.labelId+"&sourceAssetCode="+this.data.resourceAssetCode,
					  	method: 'post',
					  	dataType: 'json',
					  	timeout: 10000 * 60,
					  	header: {
					  	  "sysToken": uni.getStorageSync("PMStoken"),
					  	},
					  	data: {},
					  	success: (res) => {
					  		uni.hideLoading();
					  		console.log('获取图片地址00:', res.data);
							if(res.data.code=="200"){
								if(res.data.data!=null){
									
									this.Sticker=res.data.data.labelLocation
									this.tupianList.push({
										fileUrl:res.data.data.labelPhotoId,

									})
								}else{
								
								}
							}else{
								// uni.showModal({
								//   title: "温馨提示",
								//   content:res.data.message==null?"图片信息查询失败":res.data.message,
								//   showCancel: false,
								// });
							}
							
					  		uni.hideLoading();
					  		uni.stopPullDownRefresh();	
					  	},
					  	fail: (data, code) => {
					  		uni.hideLoading();
					  		uni.stopPullDownRefresh();
					  		console.log('fail' + JSON.stringify(data));
					  	}
					  });
			},
        fileData(url){
            return (window.location.protocol + "//" + window.location.host + process.uniEnv.BASE_JM+"/pic/openUrl?httpUrl="+ url)
        },
			previewImage(index,e) {
				// this.type = "center"
				// this.$refs.popup.open( "center")
				let lister=[];
				this.tupianList.forEach((item)=>{
					lister.push(item.fileUrl)
				})
          let current=this.fileData(e);
          let urls=lister.map((item)=>{
              return this.fileData(item);
          })
          uni.previewImage({
              current,
              urls,
          })
			},
			delectImg(x){
				console.log("删除图片",x)
				this.tupianList.splice(x, 1)
				// this.showPhotoer=true;
			},
			fiwfwsfsferer(url){
				console.log("照片")
				uni.uploadFile({
					url: process.uniEnv.BASE_JM+"/pic/uploadFile",
					filePath: url,
					formData:{
						docType:"A1102",
						aiRecognitionType:"0",
						supplierUserAccount:"hudf"
					},
					// formData:data.aiInfo || {},
					name: 'file',
					header: {
						'sysToken': uni.getStorageSync("PMStoken"),
					},
					success: ((res) => {
						let data=JSON.parse(res.data)
						console.log("canshu11",data)
						if(data.code=="200"){
							
							this.tupianList.push({
								fileUrl:data.data.innerHttpUrl,
								imgid:data.data.fileId
							})
							console.log("图片信息",this.tupianList)
						}else{
							uni.showModal({
    confirmColor: '#eb4b4b',
							  title: "温馨提示",
							  content:data.msg==null?"上传失败,请重新选择":data.msg,
							  showCancel: false,
							});
						}
						
					}),
					fail: ((err) => {
						reject(err)
						uni.hideLoading()
					}),
					complete: () => {
						uni.hideLoading()
					}
				});
			},
			Permissioner() {
				uni.request({
					url:uni.getStorageSync("PMS20url")+"/api/app/mainMaterialLable/isVirtualOrRoom?prjId="+this.ionerid,
					method: 'post',
					dataType: 'json',
					timeout: 10000 * 60,
					header: {
					  "sysToken": uni.getStorageSync("PMStoken"),
					},
					data: {},
					success: (res) => {
						uni.hideLoading();
						console.log('获取图片地址:', res.data);
						if(res.data.code=="200"){
							if(res.data.data&&this.data.specState!=1&&this.flag==1){
								this.Sinformation=true;
							}
							console.log('获取图片地址:');
						 // this.Sinformation=true;
						}
						uni.hideLoading();
						uni.stopPullDownRefresh();	
					},
					fail: (data, code) => {
						uni.hideLoading();
						uni.stopPullDownRefresh();
						console.log('fail' + JSON.stringify(data));
					}
				});
			},
			
			
			// 上传照片
			showPhoto() {
				console.log("获取的值==" );
				this.bottomShow = true;
			},
			//调用MOA拍照
			
			getCamera() {
				this.bottomShow = false
				let that = this
				
				imp.iCamera.open(
				 {
				  quality: 84, //图片质量
				  encodingType: imp.iCamera.EncodingType.JPEG, //图片格式
				 }, 
				 (successData)=> {
				  // console.log('这是拍照所所得：',successData); 
				  var base64Top = 'data:image/jpg;base64,';
				 
				  this.fiwfwsfsferer(base64Top+successData.originalData)
				 },
				 (err)=> {
				  uni.showModal({
    confirmColor: '#eb4b4b',
				  	title: '温馨提示',
				  	content: "相机调用失败",
				  	showCancel: false,
				  });
				 }
				);
			
				
				
			},
			//调用MOA相册
			getSelectImg() {
				this.bottomShow = false
				let that = this
				 console.log('选择图片了：'); 
				var option = {
					quality: 84,
					encodingType: imp.iCamera.EncodingType.JPEG,
					sizeLimit:1024*2,
					num:1,
					// targetWidth: 0,
					// targetHeight: 0,
					// watermark: {
					// 	content: "项目编码：345678",
					// 	color: "red",
					// 	algin: "left",
					// 	valign: "buttom"
					// }
				};
			
				var failed = (info) => {
					uni.showModal({
    confirmColor: '#eb4b4b',
						title: '温馨提示',
						content: "相机调用失败",
						showCancel: false,
					});
				};
				var success = (info) => {
				
				     var base64Top = 'data:image/jpg;base64,'
					setTimeout(() => {
					for (let i = 0; i < info.length; i++) {
						
						  this.fiwfwsfsferer(base64Top+info[i].thumbnailData)
					}
					}, 300); 
					
				};
				imp.iCamera.select(option, success, failed);
				
			},
			
			
			// 取消拍照
			cancel() {
				this.bottomShow = false
			},
			
			
			
			aPickerChange(e) {
					console.log("触发"+e.detail.value);
					this.aIndex = e.detail.value;
					this.selected1Type = this.ftypeCode[this.aIndex].name
					 this.reasoner = this.ftypeCode[this.aIndex].name
			},
			
			
			// 跳转至经分系统
      schemeert(options,amger){
        this.$axios.get('/material/api/pub/material/getOtherSysIpAndPort',{ sysCode:'jingFenSysIpAndPort'}).then((res)=>{
          imp.iWindow.open({url:`${res.data}/api/user/getRedirectToBcsystem?resourceAssetCode=${options}&elabelNum=${amger}`})
        })
      },
			back() {
				uni.navigateBack({
					delta: 1
				});
			},
			scanCode(){
				// this.lister();
				let that = this
				
				imp.iBarCode.scan(function (result) {
					//直接调用接口
					console.log('扫码id==',result)
					if(that.newIdCode == result){
						uni.showModal({
    confirmColor: '#eb4b4b',
							title: '温馨提示',
							content: "请勿重复扫码",
							showCancel: false,
						})
						return
					}
					this.Sticker=""
					this.tupianList=[]
					that.newIdCode = result // 新ID号
					
				});
				
				// this.newIdCode = 'T1000047376'
				this.newId = false  // 	切换 隐藏红色字体，显示ID号
			},
			onOk(e){
				//1是确认，2是取消
				if(e === 1){
					// this.changeCode()
					
					if(this.Sinformation){
						if(this.Sticker==""){
							uni.showModal({
    confirmColor: '#eb4b4b',
								title: '温馨提示',
								content: "物料编码已赋码成功，请填写贴签位置",
								showCancel: false,
							})
							return
						}
						if(this.tupianList.length==0){
							uni.showModal({
    confirmColor: '#eb4b4b',
								title: '温馨提示',
								content: "物料编码已赋码成功，请上传贴签照片",
								showCancel: false,
							})
							return
						}

					}
					if(this.selected1Type){
						// this.isShowModal = true
              this.swapMode = '02'
              // this.isShowModal = false
              this.changeCode()
					}else{
						uni.showModal({
    confirmColor: '#eb4b4b',
							title: '温馨提示',
							content: "请选择换签原因",
							showCancel: false,
						})
					}
				}else if(e === 2){
					// this.newId = true
					uni.navigateBack({
						delta: 1
					});
				}else{
            console.log(1111)
        }
			},	
			changeCode(){
				if(this.newIdCode == ""){
					
				}
				uni.showLoading({
				  title: "加载中...",
				  mask: true
				});
				var indexer
				if(this.flag=="1"){
					indexer=1;
				}else{
					indexer=3;
				}
				console.log("当前模式"+this.flag)
				console.log("提交的数据"+this.data.resourceAssetCode)
				console.log("提交的数据"+this.data.labelId)
				console.log("提交的数据"+this.newIdCode)
			
				let urls = ""
				let pams={}
				//1是服务换签2是辅材换签
				if(this.flag == 1){
					// urls = "/api/app/serverLable/swapServConfirm?resourceAssetCode=" + this.data.resourceAssetCode +"&oldLabelId="+ this.data.labelId +"&newLabelId=" + this.newIdCode + "&swapMode=" + this.swapMode + "&isFromPhoto=1&reason="+this.reasoner
				    urls = "/api/app/serverLable/swapServConfirm"
					if(this.Sinformation){
						pams= {
						resourceAssetCode:this.data.resourceAssetCode,
						oldLabelId:this.data.labelId ,
						newLabelId:this.newIdCode,
						swapMode:this.swapMode,
						isFromPhoto:1,
						reason:this.reasoner,
						labelLocation:this.Sticker,
						labelPhotoId:this.tupianList[0].fileUrl
					  }
					}else{
						pams= {
						resourceAssetCode:this.data.resourceAssetCode,
						oldLabelId:this.data.labelId ,
						newLabelId:this.newIdCode,
						swapMode:this.swapMode,
						isFromPhoto:1,
						reason:this.reasoner,
						labelLocation:"",
						labelPhotoId:""
					   }
					}	
					
					
				}else{
					 urls = "/api/app/auxMaterial/swapAuxConfirm?resourceAssetCode=" + this.data.resourceAssetCode +"&oldLabelId="+ this.data.labelId +"&newLabelId=" + this.newIdCode + "&swapMode=" + this.swapMode + "&isFromPhoto=1&reason="+this.reasoner
                    // urls = "/api/app/auxMaterial/swapAuxConfirm"
				}
						//T1000003411		
					uni.request({
						url: uni.getStorageSync("PMS20url") + urls,
						method: 'POST',
						dataType: 'json',
						timeout: 10000 * 60,
						header: {
							"sysToken": uni.getStorageSync("PMStoken"),
						},
						data:pams,
						success: (res) => {
							uni.hideLoading();
							//console.log('列表数据:' + JSON.stringify(res));
								
							var data = res.data;
							var result = JSON.stringify(data)
							console.log('接口数据:' + result);
							if (data.code == "200") {
								this.listerqe();
								uni.showModal({
    confirmColor: '#eb4b4b',
									title: '温馨提示',
									content: "换签成功",
									showCancel: false,
									success: () => {
									// --------主要是以下代码---------
									let pages = getCurrentPages();
									let prevPage = pages[pages.length - 2];
									prevPage.$vm.schoolNameert = indexer;
									uni.navigateBack({
										delta: 1
									})								 
																	     
									 },
								})
								
								
								
								
								// uni.navigateTo({
								// 	url: './detail'
								// });
								// uni.showToast({ // 提示框
								// 	title: '换签成功',
								// 	duration: 1000
								// });
								// uni.hideToast();

								// setTimeout(()=>{ // 跳转至上级页面
								// 	uni.navigateBack({
								// 		delta: 1
								// 	});
								// },1000)
							} else {
								uni.showModal({
    confirmColor: '#eb4b4b',
									title: '温馨提示',
									content: data.message,
									showCancel: false,
								})
							}
								
							uni.hideLoading();
							uni.stopPullDownRefresh();
								
						},
						fail: (data, code) => {
							uni.showModal({
    confirmColor: '#eb4b4b',
							  title: "温馨提示",
							  content: "接口调用失败,请联系系统支撑人员处理",
							  showCancel: true,
							});
							uni.hideLoading();
							uni.stopPullDownRefresh();
							console.log('fail' + JSON.stringify(data));
						}
					});
			},
			lister(){
				var urler=`${process.uniEnv.BASE_ZYSJK}`;
					uni.request({
						url:urler+"/appManagerController/getResourceReplaceLabelLog",
						//url:"http://120.52.136.13:29090/pageApp/appManagerController/getResourceReplaceLabelLog",
						method: 'POST',
						dataType: 'json',
						timeout: 10000 * 60,
						header: {},
						data: {
							assetNo:this.data.resourceAssetCode,
							sysSource:""
						},
						success: (res) => {
							uni.hideLoading();
							var data = res.data;
							var result = JSON.stringify(data)
							if (data.resultStat == "000") {
							} else {
							}
							uni.hideLoading();
							uni.stopPullDownRefresh();
								
						},
						fail: (data, code) => {
							uni.hideLoading();
							uni.stopPullDownRefresh();
							console.log('fail' + JSON.stringify(data));
						}
					});
			},	
			listerqe(){
				var urler=`${process.uniEnv.BASE_ZYSJK}`;
				var indexer
				if(this.flag=="1"){
					indexer=1;
				}else{
					indexer=3;
				}
				// 原因   this.reasoner                是否保留原签   this.swapMode
				console.log("u000rler",`${process.uniEnv.BASE_ZYSJK}`)
					uni.request({
						url:urler+"/appManagerController/insertOuterResourceReplaceLabelLog",
						//url:"http://192.168.113.13:10068/appManagerController/insertOuterResourceReplaceLabelLog",
						//url:"http://120.52.136.13:29090/pageApp/appManagerController/insertOuterResourceReplaceLabelLog",
						method: 'POST',
						dataType: 'json',
						timeout: 10000 * 60,
						header: {},
						data: 
						{
						   "resId":"",
						   "assetNo":this.data.resourceAssetCode,
						    "action":"2",
						    "roles":uni.getStorageSync("roleser"),
						    "labelId":this.newIdCode,
						    "cityId":"",
						    "cityName":"",
						    "provinceId":"",
						    "provinceName":"",
						    "reason":this.reasoner,    //换签原因
						    "sysSource":"PMS",
							"oldLabelId":this.data.labelId,
                "createLoginName":uni.getStorageSync("zyEmpName"),
                "createOp":uni.getStorageSync("zyUserId"),
						},
						success: (res) => {
							uni.hideLoading();
							var data = res.data;
							var result = JSON.stringify(data)
							console.log('接口数据:' + result);
							if (data.resultStat == "000") {
								// uni.showModal({
								// 	title: '温馨提示',
								// 	content: "换签成功",
								// 	showCancel: false,
								// 	success: (res) => {
								// 	// --------主要是以下代码---------
								// 	let pages = getCurrentPages();
								// 	let prevPage = pages[pages.length - 2];
								// 	prevPage.$vm.schoolNameert = indexer;
								// 	uni.navigateBack({
								// 		delta: 1
								// 	})								 
																	     
								// 	 },
								// })
								this.lister();
								
								// setTimeout(()=>{ // 跳转至上级页面
								// 	uni.navigateBack({
								// 		delta: 1
								// 	});
								// },1000)
							} else {
								// uni.showModal({
								// 	title: '温馨提示',
								// 	content: "数据记录失败",
								// 	showCancel: false,
								// })
							}
								
							uni.hideLoading();
							uni.stopPullDownRefresh();
								
						},
						fail: (data, code) => {
							uni.hideLoading();
							uni.stopPullDownRefresh();
							console.log('fail' + JSON.stringify(data));
						}
					});
			},	
			// 点击换签模式弹框选项
			modalClick(value){
				this.swapMode = value
				this.isShowModal = false
				this.changeCode()
				
			}
		}
	}
</script>
	
<style>
	@import '@/common/common-ui.css';
</style>
<style scoped lang="scss">
	.collapseItem{
		border: 1px solid #E4E4E4;
		border-bottom: 0;
		margin: 6rpx 0;
		.content{
			.contentItem{
				border-top: 1px solid #E4E4E4;
				padding: 20rpx 0;
				display: flex;
				
				.text{
					width: 30%;
					display: inline-block;
					margin-left: 5%;
				}
			}
		}
	}
	.buttonBox{
		position: fixed;
		bottom: 0;
		width: 100vw;
		display: flex;
		background-color: #FFFFFF;
	}
	.common-list-a{
		width: 100%;
		overflow: hidden;
		/* height: 45px; */
		/* line-height: 40px; */
		//font-size: 18px;
		color: #333333;
		display: flex;
		margin-bottom: 5px;
		border: 1px solid #00000010;
		.common-list-b{
			width: 22%;
			height: auto;
			padding:10rpx 0 10rpx 14rpx;
			background-color: white;
			display: flex;
			/* align-items: center; */
			justify-content: space-around;
			flex-direction: column;
			border-right: 1px solid #00000010;
		}
		.common-list-c{
			width: 78%;
			padding:20rpx 10rpx 20rpx 10rpx;
			background-color: #00000008;
			height: auto;
			padding:10rpx 0 10rpx 14rpx;
			display: flex;
			justify-content: space-around;
			flex-direction: column; 
		}
	}
	
	.photo-item {
		width: 24%;
		display: inline-block;
	    padding-top: 14rpx;
		//height: 200rpx;
	
		/* display: flex;
		flex-direction: column; */
		position: relative;
	}
	.photo-image {
		width: 140rpx;
		height: 140rpx;
		margin:10 20px;
	}
	.photo-delete-btn {
		width: 20px;
		height: 20px;
		position: absolute;
		top: 0rpx;
		right: 34rpx;
	}	
	
</style>
